﻿--OsvitaUa part

create table [OsvitaUa_University]
(
Id int not null primary key identity(1,1),
Name varchar(400),
ShortName varchar(200),
Tel varchar(100),
Mail varchar(200),
Website varchar(200),
AddressUniv varchar(500),
CoordinatesMap varchar(200),
LogoPath varchar(200),
UniversityType varchar(200),
Ownershipp varchar(100),
CostOfTraining varchar(100),
FormOfStady varchar(200),
Sity varchar(100),
Ratings varchar(2000),
DetailInfo varchar(max),
SourceSite varchar(100),
FreeStady bit,
PaidStady bit,
PostgraduateEducation bit,
PostgraduateDoctoral bit,
MilitaryDepartment bit,
Hostel bit,
TraininingDepartment bit,
PreparationCourses bit,
AccreditationLevelName varchar(50)
);
create table [OsvitaUa_QualificationLevel]
(
Id int not null primary key identity(1,1),
Name varchar(100)
)
create table [OsvitaUa_QualificationOfUniversity]
(
Id int primary key identity(1,1),
UniversityId int foreign key references OsvitaUa_University(Id),
QualificationLevelId int foreign key references OsvitaUa_QualificationLevel(Id)
)
create table [OsvitaUa_Direction]
(
Id int not null primary key identity(1,1),
Name varchar(100)
)
create table [OsvitaUa_Speciality]
(
Id int not null primary key identity(1,1),
Name varchar(100),
DirectionId int foreign key references OsvitaUa_Direction(Id)
)
create table [OsvitaUa_UniversitySpeciality]
(
Id int  not null primary key identity(1,1),
UnivesityId int foreign key references OsvitaUa_University(Id),
SpecityId int foreign key references OsvitaUa_Speciality(Id)
)

--Osvita.Com.Ua part

create table [OsvitaComUa_University]
(
Id int not null primary key identity(1,1),
Name varchar(200),
ShortName varchar(50),
CountOfStydent int,
CountOfTeacher int,
CountOfCandidatesOfSciences int,
CountOfProfessorwsAndDoctors int,
ForAbiturientsHTML nvarchar(max),
DetailInfoAboutUniv nvarchar(max),
SourceHref varchar(200)
)
create table [OsvitaComUa_Images]
(
Id int not null primary key identity(1,1),
UniversityId int foreign key references OsvitaComUa_University(Id),
ImageName varchar(100)
)
create table [OsvitaComUa_GroupOfProfession]
(
Id int  not null primary key identity(1,1),
Name varchar(200)
)
create table [OsvitaComUa_Profession]
(
Id int not null primary key identity(1,1),
Name varchar(200),
GroupOfProfessionId int foreign key references OsvitaComUa_GroupOfProfession(Id),
TheSpecificityOfTheProfession nvarchar(max),
PlaceOfJob nvarchar(max),
PersonalCharacteristics nvarchar(max),
Career nvarchar(max),
AllText nvarchar(max),
SourceHref varchar(200)
)

--RealvnzDb part

create table [RealvnzDb_Region](
	[RegionId] [int] NOT NULL primary key,
	[Name] [nvarchar](50) NOT NULL
)
create table [RealvnzDb_Department](
	DepartmentId int not null primary key,
	Name nvarchar(MAX),
	RegionId int not null foreign key references RealvnzDb_Region(RegionId)
)
create table [RealvnzDb_City](
	[CityId] [int] NOT NULL primary key,
	[RegionId] [int] NOT NULL foreign key references RealvnzDb_Region(RegionId),
	[Name] [nvarchar](64) NOT NULL
)

--VstupDb part

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VstupDb_Branch](
	[BranchId] [int] NOT NULL,
	[EducationalQualificationsGroupId] [int] NOT NULL,
	[Name] [nvarchar](max) NOT NULL,
	[YearId] [int] NOT NULL,
 CONSTRAINT [PK_Branch] PRIMARY KEY CLUSTERED 
(
	[BranchId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VstupDb_Direction](
	[DirectionId] [int] NOT NULL,
	[Name] [nvarchar](max) NOT NULL,
	[BranchId] [int] NOT NULL,
	[YearId] [int] NOT NULL,
	[Code] [nvarchar](max) NOT NULL,
	[DirectionTypeId] [int] NULL,
 CONSTRAINT [PK_Direction] PRIMARY KEY CLUSTERED 
(
	[DirectionId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[VstupDb_DirectionType]    Script Date: 3/1/2015 7:07:00 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VstupDb_DirectionType](
	[DirectionTypeId] [int] NOT NULL,
	[Name] [nvarchar](max) NOT NULL,
 CONSTRAINT [PK_DirectionType] PRIMARY KEY CLUSTERED 
(
	[DirectionTypeId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[VstupDb_EducationalQualifications]    Script Date: 3/1/2015 7:07:00 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VstupDb_EducationalQualifications](
	[EducationalQualificationsId] [int] NOT NULL,
	[Name] [nvarchar](max) NOT NULL,
	[EducationalQualificationsGroupId] [int] NOT NULL,
	[YearId] [int] NOT NULL,
 CONSTRAINT [PK_EducationalQualificationsGroup] PRIMARY KEY CLUSTERED 
(
	[EducationalQualificationsId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[VstupDb_EducationalQualificationsGroup]    Script Date: 3/1/2015 7:07:00 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VstupDb_EducationalQualificationsGroup](
	[EducationalQualificationsGroupId] [int] NOT NULL,
	[Name] [nvarchar](max) NOT NULL,
 CONSTRAINT [PK_EducationalQualificationsGroup_1] PRIMARY KEY CLUSTERED 
(
	[EducationalQualificationsGroupId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[VstupDb_EducationForm]    Script Date: 3/1/2015 7:07:00 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VstupDb_EducationForm](
	[EducationFormId] [int] NOT NULL,
	[Name] [nvarchar](max) NOT NULL,
 CONSTRAINT [PK_EducationForm] PRIMARY KEY CLUSTERED 
(
	[EducationFormId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[VstupDb_ExpandedSpecialization]    Script Date: 3/1/2015 7:07:00 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VstupDb_ExpandedSpecialization](
	[ExpandedSpecializationId] [int] NOT NULL,
	[Name] [nvarchar](max) NOT NULL,
	[YearId] [int] NOT NULL,
	[DirectionId] [int] NOT NULL,
	[SpecializationId] [int] NOT NULL,
	[BranchId] [int] NOT NULL,
 CONSTRAINT [PK_ExpandedSpecialization] PRIMARY KEY CLUSTERED 
(
	[ExpandedSpecializationId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[VstupDb_Faculty]    Script Date: 3/1/2015 7:07:00 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VstupDb_Faculty](
	[FacultyId] [int] NOT NULL,
	[Name] [nvarchar](max) NOT NULL,
	[UniversityId] [int] NOT NULL,
	[YearId] [int] NOT NULL,
 CONSTRAINT [PK_Faculty] PRIMARY KEY CLUSTERED 
(
	[FacultyId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[VstupDb_Region]    Script Date: 3/1/2015 7:07:00 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VstupDb_Region](
	[RegionId] [int] NOT NULL,
	[Name] [nvarchar](max) NOT NULL,
 CONSTRAINT [PK_Region] PRIMARY KEY CLUSTERED 
(
	[RegionId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[VstupDb_Speciality]    Script Date: 3/1/2015 7:07:00 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VstupDb_Speciality](
	[SpecialityId] [int] NOT NULL,
	[FacultyId] [int] NOT NULL,
	[DirectionId] [int] NOT NULL,
	[SpecializationId] [int] NOT NULL,
	[EducationalQualificationsId] [int] NOT NULL,
	[YearId] [int] NOT NULL,
	[EducationFormId] [int] NOT NULL,
	[ExpandedSpecializationId] [int] NOT NULL,
	[Budjet] [int] NOT NULL,
	[License] [int] NOT NULL,
	[VstupId] [int] NULL,
 CONSTRAINT [PK_Speciality] PRIMARY KEY CLUSTERED 
(
	[SpecialityId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[VstupDb_SpecialitySubject]    Script Date: 3/1/2015 7:07:00 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VstupDb_SpecialitySubject](
	[SpecialitySubjectId] [int] NOT NULL,
	[SpecialityId] [int] NOT NULL,
	[SubjectId] [int] NOT NULL,
	[IsProfile] [bit] NOT NULL,
 CONSTRAINT [PK_SpecialitySubject] PRIMARY KEY CLUSTERED 
(
	[SpecialitySubjectId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[VstupDb_Specialization]    Script Date: 3/1/2015 7:07:00 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VstupDb_Specialization](
	[SpecializationId] [int] NOT NULL,
	[Name] [nvarchar](max) NOT NULL,
	[BranchId] [int] NOT NULL,
	[YearId] [int] NOT NULL,
	[Code] [nvarchar](max) NOT NULL,
 CONSTRAINT [PK_Specialization] PRIMARY KEY CLUSTERED 
(
	[SpecializationId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[VstupDb_Subject]    Script Date: 3/1/2015 7:07:00 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VstupDb_Subject](
	[SubjectId] [int] NOT NULL,
	[Name] [nvarchar](max) NOT NULL,
	[YearId] [int] NOT NULL,
 CONSTRAINT [PK_Subject] PRIMARY KEY CLUSTERED 
(
	[SubjectId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[VstupDb_University]    Script Date: 3/1/2015 7:07:00 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VstupDb_University](
	[UniversityId] [int] NOT NULL,
	[Name] [nvarchar](max) NOT NULL,
	[UniversityTypeId] [int] NOT NULL,
	[PostIndex] [nvarchar](max) NOT NULL,
	[Address] [nvarchar](max) NOT NULL,
	[Phones] [nvarchar](max) NOT NULL,
	[Site] [nvarchar](max) NOT NULL,
	[Mail] [nvarchar](max) NOT NULL,
	[YearId] [int] NOT NULL,
	[RegionId] [int] NOT NULL,
 CONSTRAINT [PK_University] PRIMARY KEY CLUSTERED 
(
	[UniversityId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[VstupDb_UniversityType]    Script Date: 3/1/2015 7:07:00 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VstupDb_UniversityType](
	[UniversityTypeId] [int] NOT NULL,
	[Name] [nvarchar](max) NOT NULL,
 CONSTRAINT [PK_UniversityType] PRIMARY KEY CLUSTERED 
(
	[UniversityTypeId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[VstupDb_Year]    Script Date: 3/1/2015 7:07:00 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VstupDb_Year](
	[YearId] [int] NOT NULL,
	[Value] [int] NOT NULL,
 CONSTRAINT [PK_Year] PRIMARY KEY CLUSTERED 
(
	[YearId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
ALTER TABLE [dbo].[VstupDb_Branch]  WITH CHECK ADD  CONSTRAINT [FK_Branch_EducationalQualificationsGroup2] FOREIGN KEY([EducationalQualificationsGroupId])
REFERENCES [dbo].[VstupDb_EducationalQualificationsGroup] ([EducationalQualificationsGroupId])
GO
ALTER TABLE [dbo].[VstupDb_Branch] CHECK CONSTRAINT [FK_Branch_EducationalQualificationsGroup2]
GO
ALTER TABLE [dbo].[VstupDb_Branch]  WITH CHECK ADD  CONSTRAINT [FK_Branch_Year] FOREIGN KEY([YearId])
REFERENCES [dbo].[VstupDb_Year] ([YearId])
GO
ALTER TABLE [dbo].[VstupDb_Branch] CHECK CONSTRAINT [FK_Branch_Year]
GO
ALTER TABLE [dbo].[VstupDb_Direction]  WITH CHECK ADD  CONSTRAINT [FK_Direction_Branch] FOREIGN KEY([BranchId])
REFERENCES [dbo].[VstupDb_Branch] ([BranchId])
GO
ALTER TABLE [dbo].[VstupDb_Direction] CHECK CONSTRAINT [FK_Direction_Branch]
GO
ALTER TABLE [dbo].[VstupDb_Direction]  WITH CHECK ADD  CONSTRAINT [FK_Direction_DirectionType] FOREIGN KEY([DirectionTypeId])
REFERENCES [dbo].[VstupDb_DirectionType] ([DirectionTypeId])
GO
ALTER TABLE [dbo].[VstupDb_Direction] CHECK CONSTRAINT [FK_Direction_DirectionType]
GO
ALTER TABLE [dbo].[VstupDb_Direction]  WITH CHECK ADD  CONSTRAINT [FK_Direction_Year] FOREIGN KEY([YearId])
REFERENCES [dbo].[VstupDb_Year] ([YearId])
GO
ALTER TABLE [dbo].[VstupDb_Direction] CHECK CONSTRAINT [FK_Direction_Year]
GO
ALTER TABLE [dbo].[VstupDb_Direction]  WITH CHECK ADD  CONSTRAINT [FK_DirectionRating_Direction] FOREIGN KEY([DirectionId])
REFERENCES [dbo].[VstupDb_Direction] ([DirectionId])
GO
ALTER TABLE [dbo].[VstupDb_Direction] CHECK CONSTRAINT [FK_DirectionRating_Direction]
GO
ALTER TABLE [dbo].[VstupDb_EducationalQualifications]  WITH CHECK ADD  CONSTRAINT [FK_EducationalQualifications_EducationalQualificationsGroup] FOREIGN KEY([EducationalQualificationsGroupId])
REFERENCES [dbo].[VstupDb_EducationalQualificationsGroup] ([EducationalQualificationsGroupId])
GO
ALTER TABLE [dbo].[VstupDb_EducationalQualifications] CHECK CONSTRAINT [FK_EducationalQualifications_EducationalQualificationsGroup]
GO
ALTER TABLE [dbo].[VstupDb_EducationalQualifications]  WITH CHECK ADD  CONSTRAINT [FK_EducationalQualificationsGroup_Year] FOREIGN KEY([YearId])
REFERENCES [dbo].[VstupDb_Year] ([YearId])
GO
ALTER TABLE [dbo].[VstupDb_EducationalQualifications] CHECK CONSTRAINT [FK_EducationalQualificationsGroup_Year]
GO
ALTER TABLE [dbo].[VstupDb_ExpandedSpecialization]  WITH CHECK ADD  CONSTRAINT [FK_ExpandedSpecialization_Branch] FOREIGN KEY([BranchId])
REFERENCES [dbo].[VstupDb_Branch] ([BranchId])
GO
ALTER TABLE [dbo].[VstupDb_ExpandedSpecialization] CHECK CONSTRAINT [FK_ExpandedSpecialization_Branch]
GO
ALTER TABLE [dbo].[VstupDb_ExpandedSpecialization]  WITH CHECK ADD  CONSTRAINT [FK_ExpandedSpecialization_Direction] FOREIGN KEY([DirectionId])
REFERENCES [dbo].[VstupDb_Direction] ([DirectionId])
GO
ALTER TABLE [dbo].[VstupDb_ExpandedSpecialization] CHECK CONSTRAINT [FK_ExpandedSpecialization_Direction]
GO
ALTER TABLE [dbo].[VstupDb_ExpandedSpecialization]  WITH CHECK ADD  CONSTRAINT [FK_ExpandedSpecialization_Specialization] FOREIGN KEY([SpecializationId])
REFERENCES [dbo].[VstupDb_Specialization] ([SpecializationId])
GO
ALTER TABLE [dbo].[VstupDb_ExpandedSpecialization] CHECK CONSTRAINT [FK_ExpandedSpecialization_Specialization]
GO
ALTER TABLE [dbo].[VstupDb_ExpandedSpecialization]  WITH CHECK ADD  CONSTRAINT [FK_ExpandedSpecialization_Year] FOREIGN KEY([YearId])
REFERENCES [dbo].[VstupDb_Year] ([YearId])
GO
ALTER TABLE [dbo].[VstupDb_ExpandedSpecialization] CHECK CONSTRAINT [FK_ExpandedSpecialization_Year]
GO
ALTER TABLE [dbo].[VstupDb_Faculty]  WITH CHECK ADD  CONSTRAINT [FK_Faculty_University] FOREIGN KEY([UniversityId])
REFERENCES [dbo].[VstupDb_University] ([UniversityId])
GO
ALTER TABLE [dbo].[VstupDb_Faculty] CHECK CONSTRAINT [FK_Faculty_University]
GO
ALTER TABLE [dbo].[VstupDb_Faculty]  WITH CHECK ADD  CONSTRAINT [FK_Faculty_Year] FOREIGN KEY([YearId])
REFERENCES [dbo].[VstupDb_Year] ([YearId])
GO
ALTER TABLE [dbo].[VstupDb_Faculty] CHECK CONSTRAINT [FK_Faculty_Year]
GO
ALTER TABLE [dbo].[VstupDb_Speciality]  WITH CHECK ADD  CONSTRAINT [FK_Speciality_Direction] FOREIGN KEY([DirectionId])
REFERENCES [dbo].[VstupDb_Direction] ([DirectionId])
GO
ALTER TABLE [dbo].[VstupDb_Speciality] CHECK CONSTRAINT [FK_Speciality_Direction]
GO
ALTER TABLE [dbo].[VstupDb_Speciality]  WITH CHECK ADD  CONSTRAINT [FK_Speciality_EducationalQualifications] FOREIGN KEY([EducationalQualificationsId])
REFERENCES [dbo].[VstupDb_EducationalQualifications] ([EducationalQualificationsId])
GO
ALTER TABLE [dbo].[VstupDb_Speciality] CHECK CONSTRAINT [FK_Speciality_EducationalQualifications]
GO
ALTER TABLE [dbo].[VstupDb_Speciality]  WITH CHECK ADD  CONSTRAINT [FK_Speciality_EducationForm] FOREIGN KEY([EducationFormId])
REFERENCES [dbo].[VstupDb_EducationForm] ([EducationFormId])
GO
ALTER TABLE [dbo].[VstupDb_Speciality] CHECK CONSTRAINT [FK_Speciality_EducationForm]
GO
ALTER TABLE [dbo].[VstupDb_Speciality]  WITH CHECK ADD  CONSTRAINT [FK_Speciality_ExpandedSpecialization] FOREIGN KEY([ExpandedSpecializationId])
REFERENCES [dbo].[VstupDb_ExpandedSpecialization] ([ExpandedSpecializationId])
GO
ALTER TABLE [dbo].[VstupDb_Speciality] CHECK CONSTRAINT [FK_Speciality_ExpandedSpecialization]
GO
ALTER TABLE [dbo].[VstupDb_Speciality]  WITH CHECK ADD  CONSTRAINT [FK_Speciality_Faculty] FOREIGN KEY([FacultyId])
REFERENCES [dbo].[VstupDb_Faculty] ([FacultyId])
GO
ALTER TABLE [dbo].[VstupDb_Speciality] CHECK CONSTRAINT [FK_Speciality_Faculty]
GO
ALTER TABLE [dbo].[VstupDb_Speciality]  WITH CHECK ADD  CONSTRAINT [FK_Speciality_Specialization] FOREIGN KEY([SpecializationId])
REFERENCES [dbo].[VstupDb_Specialization] ([SpecializationId])
GO
ALTER TABLE [dbo].[VstupDb_Speciality] CHECK CONSTRAINT [FK_Speciality_Specialization]
GO
ALTER TABLE [dbo].[VstupDb_Speciality]  WITH CHECK ADD  CONSTRAINT [FK_Speciality_Year] FOREIGN KEY([YearId])
REFERENCES [dbo].[VstupDb_Year] ([YearId])
GO
ALTER TABLE [dbo].[VstupDb_Speciality] CHECK CONSTRAINT [FK_Speciality_Year]
GO
ALTER TABLE [dbo].[VstupDb_SpecialitySubject]  WITH CHECK ADD  CONSTRAINT [FK_SpecialitySubject_Speciality] FOREIGN KEY([SpecialityId])
REFERENCES [dbo].[VstupDb_Speciality] ([SpecialityId])
GO
ALTER TABLE [dbo].[VstupDb_SpecialitySubject] CHECK CONSTRAINT [FK_SpecialitySubject_Speciality]
GO
ALTER TABLE [dbo].[VstupDb_SpecialitySubject]  WITH CHECK ADD  CONSTRAINT [FK_SpecialitySubject_Subject] FOREIGN KEY([SubjectId])
REFERENCES [dbo].[VstupDb_Subject] ([SubjectId])
GO
ALTER TABLE [dbo].[VstupDb_SpecialitySubject] CHECK CONSTRAINT [FK_SpecialitySubject_Subject]
GO
ALTER TABLE [dbo].[VstupDb_Specialization]  WITH CHECK ADD  CONSTRAINT [FK_Specialization_Branch] FOREIGN KEY([BranchId])
REFERENCES [dbo].[VstupDb_Branch] ([BranchId])
GO
ALTER TABLE [dbo].[VstupDb_Specialization] CHECK CONSTRAINT [FK_Specialization_Branch]
GO
ALTER TABLE [dbo].[VstupDb_Specialization]  WITH CHECK ADD  CONSTRAINT [FK_Specialization_Year] FOREIGN KEY([YearId])
REFERENCES [dbo].[VstupDb_Year] ([YearId])
GO
ALTER TABLE [dbo].[VstupDb_Specialization] CHECK CONSTRAINT [FK_Specialization_Year]
GO
ALTER TABLE [dbo].[VstupDb_Subject]  WITH CHECK ADD  CONSTRAINT [FK_Subject_Year] FOREIGN KEY([YearId])
REFERENCES [dbo].[VstupDb_Year] ([YearId])
GO
ALTER TABLE [dbo].[VstupDb_Subject] CHECK CONSTRAINT [FK_Subject_Year]
GO
ALTER TABLE [dbo].[VstupDb_University]  WITH CHECK ADD  CONSTRAINT [FK_University_Region] FOREIGN KEY([RegionId])
REFERENCES [dbo].[VstupDb_Region] ([RegionId])
GO
ALTER TABLE [dbo].[VstupDb_University] CHECK CONSTRAINT [FK_University_Region]
GO
ALTER TABLE [dbo].[VstupDb_University]  WITH CHECK ADD  CONSTRAINT [FK_University_UniversityType] FOREIGN KEY([UniversityTypeId])
REFERENCES [dbo].[VstupDb_UniversityType] ([UniversityTypeId])
GO
ALTER TABLE [dbo].[VstupDb_University] CHECK CONSTRAINT [FK_University_UniversityType]
GO
ALTER TABLE [dbo].[VstupDb_University]  WITH CHECK ADD  CONSTRAINT [FK_University_Year] FOREIGN KEY([YearId])
REFERENCES [dbo].[VstupDb_Year] ([YearId])
GO
ALTER TABLE [dbo].[VstupDb_University] CHECK CONSTRAINT [FK_University_Year]
GO
ALTER TABLE [dbo].[VstupDb_Year]  WITH CHECK ADD  CONSTRAINT [FK_DirectionRating_Year] FOREIGN KEY([YearId])
REFERENCES [dbo].[VstupDb_Year] ([YearId])
GO
ALTER TABLE [dbo].[VstupDb_Year] CHECK CONSTRAINT [FK_DirectionRating_Year]
GO
